﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static SimpleWebApi.MyMigration.AdvancedCustomerDbContext;

namespace SimpleWebApi.MyMigration.Models.BusinessLicenseManagement
{
    public enum CompanyType
    {
        个体工商户,
        家庭农场,
        公司
    }

    public class BusinessLicense : BaseEntity
        {

        [Comment("企业信用代码（唯一）")]
        [StringLength(18, MinimumLength = 18)]
        [Column(TypeName = "varchar(18)")]
        public string? CreditCode { get; set; } // 企业信用代码（唯一）


        [Comment("企业字号")]
        [StringLength(100)]
        public string? TradeName { get; set; } // 企业字号


        [Comment("注册资金")]
        public string? RegisteredCapital { get; set; } // 注册资金

        [Comment("从业人数")]
        public int? EmployeeCount { get; set; } // 从业人数

        [Comment("企业类型")]
        
        public CompanyType? CompanyType { get; set; }  // 企业类型

        [Comment("经营范围")]
        [StringLength(500)]
        public string? BusinessScope { get; set; } // 经营范围

        [Comment("经营场所")]
        [StringLength(255)]
        public string? BusinessAddress { get; set; } // 经营场所

        // 多对一关系：多个营业执照对应一个法人
        public int LegalPersonId { get; set; }
        public LegalPerson LegalPerson { get; set; }


        // 多对多导航属性
        public ICollection<BusinessLicenseRelatedPerson>? RelatedPersons { get; set; } = new HashSet<BusinessLicenseRelatedPerson>();
    }
    
}
